﻿<UserControl x:Class="comicEditor"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:local="clr-namespace:eComicEditor"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" MinWidth="300" MinHeight="300" Background="White">
    <UserControl.Resources>
        <DataTemplate x:Name="EditorList" x:Key="EditorList" 
                      DataType="{x:Type local:comicPage}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="20" />
                    <ColumnDefinition Width="20" />
                    <ColumnDefinition Width="20" />
                    <ColumnDefinition Width="20" />
                    <ColumnDefinition Width="Auto" />
               </Grid.ColumnDefinitions>
                <Button Name="btnMoveUp" Grid.Column="0" ToolTip="Move This Page Up" Width="20" MaxWidth="20"
                        Click="btnMoveUp_Click" HorizontalAlignment="Center" VerticalAlignment="Top">
                    <Image Source="/eComicEditor;component/Resources/moveup.png" />
                </Button>
                <Button Name="btnMoveDown" Grid.Column="1" ToolTip="Move This Page Down" Width="20" MaxWidth="20"
                        Click="btnMoveDown_Click" HorizontalAlignment="Center" VerticalAlignment="Top">
                    <Image Source="/eComicEditor;component/Resources/movedown.png" />
                </Button>
                <Button Name="btnEditPageDetails" Grid.Column="2" ToolTip="Edit Page Details" Width="20" MaxWidth="20"
                        Click="btnEditPageDetails_Click" HorizontalAlignment="Center" VerticalAlignment="Top">
                    <Image Source="/eComicEditor;component/Resources/edit.png" />
                </Button>
                <Button Name="btnRemovePage" Grid.Column="3" ToolTip="Remove Page" Width="20" MaxWidth="20"
                        Click="btnRemovePage_Click" HorizontalAlignment="Center" VerticalAlignment="Top">
                    <Image Source="/eComicEditor;component/Resources/remove.png" />
                </Button>
                <DockPanel Grid.Column="4">
                    <Image DockPanel.Dock="Left" Source="{Binding FileNameUri}" MaxHeight="45" MaxWidth="45"
                           Height="Auto" Width="Auto" />
                    <Label VerticalAlignment="Top" Content="{Binding FileName}" />
                </DockPanel>
            </Grid>
        </DataTemplate>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="3*" />
            <ColumnDefinition Width="6*" />
        </Grid.ColumnDefinitions>
        <ScrollViewer Grid.Column="0" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto" >
            <Grid Grid.Column="0" VerticalAlignment="Top" >
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Label Grid.Row="0" Content="Title:" />
                <TextBox Text="{Binding Title}" Grid.Row="1" />
                <Label Grid.Row="2" Content="Series:" />
                <TextBox Text="{Binding Series}" Grid.Row="3" />
                <Label Grid.Row="4" Content="Issue Number:" />
                <TextBox Text="{Binding Number}" Grid.Row="5" />
                <Label Grid.Row="6" Content="Volume:" />
                <TextBox Text="{Binding Volume}" Grid.Row="7" />

                <Label Grid.Row="8" Content="Summary:" />
                <TextBox Text="{Binding Number}" Grid.Row="9" Height="40" TextWrapping="Wrap"  />
                <Label Grid.Row="10" Content="Notes:" />
                <TextBox Text="{Binding Number}" Grid.Row="11" Height="50" TextWrapping="Wrap" />
            </Grid>
        </ScrollViewer>
        <GridSplitter/> 
        <GroupBox Grid.Row="0" Grid.Column="1" >
            <GroupBox.Header>
                <StackPanel Orientation="Horizontal">
                    <Label Content="Pages" />
                    <Button Name="cmdNewPage" ToolTip="Add New Page"
                            Click="cmdNewPage_Click" Width="20" MaxWidth="20">
                        <Image Source="/eComicEditor;component/Resources/add.png" />
                    </Button>
                </StackPanel>
            </GroupBox.Header>
            <DockPanel>
                
                <ListBox Name="lsbItems" ItemTemplate="{DynamicResource EditorList}"
                         ItemsSource="{Binding ComicPages}"  IsSynchronizedWithCurrentItem="True" 
                         SelectionMode="Single" AllowDrop="True" Visibility="Visible" 
                         DockPanel.Dock="Top" >
                </ListBox>

            </DockPanel>
        </GroupBox>
    </Grid>
</UserControl>
